﻿using DoNetDrive.Core.Command;
using DoNetDrive.Core.Packet;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Face8280WebSocketServer.Command.Search
{
    public class UDPSerach : JsonCommand
    {
        string _Txzt;
        UDPSerachResult _UDPSerach;
        public UDPSerach(INCommandDetail cd) : base(cd, null)
        {
            _Decompile = new TextPacketDecompile();
            _Txzt = new
            {
                cmd = "UDPSerach",
                Ver = 1
            }.ToJson() ;
            _UDPSerach = new UDPSerachResult();
            _Result = _UDPSerach;
        }
        protected override void CommandNext(INPacket readPacket)
        {
            if (readPacket is TextPacket)
            {
                var jPck = readPacket as TextPacket;
                var sJson = jPck.GetJson();
                _UDPSerach.Add(sJson);
            }
        }

        protected override void CommandReSend()
        {

        }

        protected override void CreatePacket()
        {
            // var sJson = JsonConvert.SerializeObject(mSendObject, setting);
            _Packet = new TextPacket(_Txzt);
            _ProcessStep = 1;
        }

    }
}
